package com.cuij.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cuij.entity.Result;
import com.cuij.service.orderInfoService;

@Controller
@RequestMapping("/info")
public class orderInfoController {

    @Resource
    private orderInfoService orderinfoservice;

    @RequestMapping("/createorder.do")
    @ResponseBody
    public Result createOrderExecute(String goodsinfo, double totalprice, String busi_id, String use_id) {
        Result result = orderinfoservice.createOrder(goodsinfo, totalprice, busi_id, use_id);
        return result;
    }

    @RequestMapping("/findorderinfo.do")
    @ResponseBody
    public Result findOrderInfoExecute(String order_id, String use_id) {
        Result result = orderinfoservice.findOrderInfo(order_id, use_id);
        return result;
    }

    @RequestMapping("/confirmorder.do")
    @ResponseBody
    public Result confirmOrderExecute(String use_id, String order_id, String address, double totalprice) {
        Result result = orderinfoservice.confirmOrder(use_id, order_id, address, totalprice);
        return result;
    }

    @RequestMapping("/findorderstate.do")
    @ResponseBody
    public Result findOrderStateExecute(String order_id) {
        Result result = orderinfoservice.findOrderInfo(order_id);
        return result;
    }

    @RequestMapping("/showorder.do")
    @ResponseBody
    public Result showOrderExecute(String cust_id, String busi_id, String checkstate) {
        Result result = orderinfoservice.showOrder(cust_id, busi_id, checkstate);
        return result;
    }

    // 改变订单状态
    @RequestMapping("/changestate.do")
    @ResponseBody
    public Result changeStateExecute(String order_id, String order_state) {
        Result result = orderinfoservice.changeState(order_id, order_state);
        return result;
    }

    // 查找并删除超时订单
    @RequestMapping("/outtime.do")
    @ResponseBody
    public Result outTimeExecute(String cust_id) {
        Result result = orderinfoservice.outTime(cust_id);
        return result;
    }

    // 评论成功操作
    @RequestMapping("/commentsucc.do")
    @ResponseBody
    public Result commentSuccessExecute(String order_id, double busi_level, double goods_level, String busi_comment) {
        Result result = orderinfoservice.commentSuccess(order_id, busi_level, goods_level, busi_comment);
        return result;
    }
}
